var Dom = YAHOO.util.Dom;
	
var Wallet = {
	widget: {
		OverlayManager: new YAHOO.widget.OverlayManager()
	},
	lang: {
		apply: function(destination, source) {
			for(var prop in source) {
				destination[prop] = source[prop];
			}
		},
		applyIf: function(destination, source) {
			if (destination != null) {
				for(var prop in source) {
					if (!destination[prop]) {
						destination[prop] = source[prop];
					}
				}	
			}
		}
	},
	util: {
		toArray: function(nodeList) {
			var array = new Array();
			for (var idx = 0, length = nodeList.length; idx < length; idx++) {
				array.push(nodeList[idx]);
			}
			
			return array;
		}
	},
	element: {
		methods: {
			addClass: function(el, cls) {
				Dom.addClass(el, cls);
			},
			hide: function(el) {
				Dom.setStyle(el, "display", "none");
			},
			show: function(el) {
				Dom.setStyle(el, "display", "");
			},
			setStyle: function(el, prop, val) {
				Dom.setStyle(el, prop, val);
			}				
		},
		Element: function(el) {
			this.el = Dom.get(el);
		},
		addMethods: function() {
			for (var func in this.methods) {				
				this.Element.prototype[func] = function() {
					var method = this.methods[func];
					
					return function() {
						var array = Wallet.util.toArray(arguments);
						var args = [this.el].concat(array);
						method.apply(this, args);
					}
				}.call(this);
			}
		}
	}
};
	
Wallet.element.addMethods();
